package com.mrd.payClient.utils;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;

public class ProperUtils {
	private static ProperUtils propUtils = null;
	private String playServerIp = "";
	
	//静态方法访问时，直接访问不需要实例化  
	public static synchronized ProperUtils getInstance(){
		if(propUtils == null){
			propUtils = new ProperUtils();  
		}  
		return propUtils;  
	}  

	public ProperUtils(){
		try{
			 InputStream inCfg = getClass().getClassLoader().getResourceAsStream("client.properties");
			 Properties prop = new Properties();
			 if(inCfg!=null){
		         prop.load(inCfg);
			 }else{
				 FileInputStream in = new FileInputStream(Thread.currentThread().getContextClassLoader().getResource("").getPath()+"/"+"client.properties");
				 prop.load(in);
				 in.close();
			 }
	         playServerIp = prop.getProperty("playServerIp");
		}catch(Exception ex){
			ex.printStackTrace();
		}
	}

	public String getPlayServerIp() {
		return playServerIp;
	}

}
